package com.sanpu.kxe.business.trade.adapter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import com.sanpu.kxe.business.trade.contract.TradeConfig;
import com.sanpu.kxe.business.trade.fragment.ChargerTelFeeFragment;

import java.util.ArrayList;

/**
 * Description：话费流量page
 * Created by 薛勇军 on 2019/3/20.
 */

public class ChargerPageAdapter extends FragmentPagerAdapter {

    ArrayList<Fragment> fragments = new ArrayList<>();

    public ChargerPageAdapter(FragmentManager fm, String mobileRechargeTable) {
        super(fm);
        switch (mobileRechargeTable) {
            case TradeConfig.RECHARGE_BALANCE:
                fragments.add(ChargerTelFeeFragment.getInstance(ChargerTelFeeFragment.AMT_CHARGER));
                break;
            case TradeConfig.RECHARGE_POINT:
                fragments.add(ChargerTelFeeFragment.getInstance(ChargerTelFeeFragment.SCORE_CHARGER));
                break;
            default:
                fragments.add(ChargerTelFeeFragment.getInstance(ChargerTelFeeFragment.AMT_CHARGER));
                fragments.add(ChargerTelFeeFragment.getInstance(ChargerTelFeeFragment.SCORE_CHARGER));
                break;
        }
    }

    @Override
    public int getCount() {
        return fragments.size();
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return "";
    }

    @Override
    public Fragment getItem(int position) {
        return fragments.get(position);
    }
}
